package com.smartHome.common;

public enum TimeRangeEnum {
    DAY(1, "日"),
    MONTH(2, "月");

    private final int code;
    private final String desc;

    TimeRangeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static String getDescByCode(int code) {
        for (TimeRangeEnum value : TimeRangeEnum.values()) {
            if (value.code == code) {
                return value.desc;
            }
        }
        throw new IllegalArgumentException("Invalid time range code: " + code);
    }
}